<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath() %>/css/Style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/img.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.3.2.js"></script>
<script type="text/javascript">
	function deleteImage(obj){
			if(confirm("确定要删除吗？")){
				var id = obj.attr("id");
				var path ='<%=request.getContextPath()%>';
				var href= window.location.href;
				$.ajax({
					type: "GET",
		            url: path + "/admin/deleteImage.htm",
		            data:{
						pid:id
		            },
		            dataType: "text",
		            success: function(result){
		            	 if(result=="success"){
		                 	 alert("操作成功！");
		                	 window.location.href=href;
		                 }else{
		              	   alert("操作失败！");
		                     }
		            },
		            error: function(){
		              alert("数据库繁忙，请稍后再试！");
		            }
				});
			}
		}
	function goPage(page){
		document.getElementById("currentPage").value=page;
		document.getElementById("n_form").submit();
	}
</script>
<title>案例查看</title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" class="thead" width="100%">
	<tr><td style="padding:3px;">当前位置:图片管理</td></tr>
</table>
<form action="<%=request.getContextPath() %>/admin/getSomeImage.htm" method="post" id="n_form">
<table cellspacing="0" cellpadding="0" border="0" align="center" width="800">
	<tbody>
		<tr height="30px">
			<td colspan="4" >
				<span class="top_c"><input type="button" value="新增" onclick="window.location.href='<%=request.getContextPath() %>/admin/admin.product.add.jsp?nodeid=${nodeid}&type=${type}'" class="btn"/></span>
			</td>
		</tr>
		<tr>
			<s:iterator value="images.datas" id="item" status="index">
			<td bgcolor="#ffffff" align="center" valign="top">
			<div><img alt="编辑" src="<%=request.getContextPath() %>/images/114.gif" />[<a href="<%=request.getContextPath() %>/admin/getImageById.htm?nodeid=${nodeid}&pid=${item.id}">编辑</a>]</div>
			<div align="center" style="margin: 10px 0px 0px;"><img height="100" border="0" width="140" class="img" onload="javascript:DrawImage(this,140,100)" src="<%=request.getContextPath() %>/<s:property value="#item.path"/>" alt="140×100"></div>
			<div align="center" id="Sub_Pro_sort"><s:property value="#item.title"/><a href="javascript:void(0);" onclick="deleteImage($(this));" style="border: 0px solid;margin-left: 5px" id="<s:property value='#item.id'/>"><img src="<%=request.getContextPath() %>/images/010.gif"/></a></div>
			</td>
			<s:if test="%{(#index.index+1)%4==0}">
			</tr>
				<tr>
					<td style="height: 10px;" colspan="4"></td>
				</tr>
			<tr>
			</s:if>
			</s:iterator>
		</tr>
		<tr>
			<td style="height: 10px;" colspan="4"></td>
		</tr>
		<tr>
			<td colspan="4" height="30px" align="right">
			<span style="padding-right:10px">[第<b>${images.currentPage}</b>页|共<b>${images.pageCount}</b>页]
					<s:if test="images.currentPage<2"><span class="disable" >&lt;&lt;上一页</span></s:if><s:else><a class="enable" href="javascript:goPage(${images.currentPage}-1)">&lt;&lt;上一页</a></s:else>
					<s:if test="images.currentPage>=images.pageCount"><span class="disable">下一页&gt;&gt;</span></s:if><s:else><a class="enable" href="javascript:goPage(${images.currentPage+1})">下一页&gt;&gt;</a></s:else>
			</span>
			</td>
		</tr>
		<tr>
		</tr>
	</tbody>
</table>
<input type="hidden" name="nodeid" value="${nodeid}">
<input type="hidden" name="type" value="${type}">
<input type="hidden" name="currentPage" value="" id="currentPage">
</form>
</body>
</html>